using FireStarterModeller.BO;
using Habanero.Testability;

namespace FireStarterModeller.Test.BO
{
    public class TestUtilsUIProp
    {

        public static BOTestFactory<UIProp> GetFactory()
        {
            return BOTestFactoryRegistry.Instance.Resolve<UIProp>();
        }

        private static int OrdinalPosition = 1;
        /// <summary>
        /// Creates a new saved UIProp with a random value assigned to every property
        /// </summary>
        public static UIProp CreateSavedUIProp()
        {
            UIProp uIField = CreateUnsavedValidUIProp();
            uIField.Save();
            return uIField;
        }

        /// <summary>
        /// Creates a new unsaved UIProp with a random value assigned to every property
        /// </summary>
        public static UIProp CreateUnsavedValidUIProp()
        {
            UIProp uIField = new UIProp();
            uIField.PropertyName = TestUtilsShared.GetRandomString();
            uIField.Editable = TestUtilsShared.GetRandomBoolean();
            uIField.ToolTipText = TestUtilsShared.GetRandomString();
            uIField.Generated = TestUtilsShared.GetRandomBoolean();
            uIField.OrdinalPosition = ++OrdinalPosition;
            return uIField;
        }

        /// <summary>
        /// Creates a new unsaved UIProp where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static UIProp CreateUnsavedDefaultUIProp()
        {
            UIProp uIField = new UIProp();
            return uIField;
        }
    }
}